package src.schoolWork;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-20
 * Time: 15:11
 */
public class Test2 {
    public static void main(String[] args) {
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("D:\\桌面\\java\\学校作业\\name.txt"));
            String s;
            while (true) {
                System.out.println("输入姓名");
                s = bufferedReader.readLine();
                if(s.length() == 0) {
                    break;
                }
                bufferedWriter.write(s);
                bufferedWriter.newLine();
            }
            bufferedReader.close();
            bufferedWriter.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
